<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body></body>
  <script>
    const obj = {
      name: '及你太美',
      age: 18,
      hobby: '舞动奇迹',
      address: '日本'
    }
    // 原始版遍历对象：for-in循环
    // for (const key in obj) {
    //   console.log(key)
    //   console.log(obj[key])
    // }
    // Object.keys(对象)：把对象的键以数组的形式返回
    // console.log(Object.keys(obj)) //['name','age','hobby','address']
    const arr = Object.keys(obj) //['name','age','hobby','address']
    console.log(arr.sort())

    console.log(Object.keys(obj).filter(key => key.startsWith('a')))
  </script>
</html>
